package com.zjt.swipeview.component;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2017</p>
 * <P>Company: </p>
 *
 * @author zhengjianting
 * @time 2017/11/23 0023 下午 4:37
 */

public class AutoLoadLayout extends LinearLayout {

    private View mTargetView;
    private View mFooterView;

    public AutoLoadLayout(Context context) {
        super(context);
        init();
    }

    public AutoLoadLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    public AutoLoadLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public AutoLoadLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        init();
    }

    private void init() {
        setOrientation(VERTICAL);
    }

    public void addView(View targetView, View footerView) {
        mTargetView = targetView;
        mFooterView = footerView;
        addView(targetView);
        addView(footerView);
    }

    public View getTargetView() {
        return mTargetView;
    }

    public View getFooterView() {
        return mFooterView;
    }
}
